/*
 * @Author: LIFM0623 1944099171@qq.com
 * @Date: 2024-02-22 20:22:51
 * @LastEditors: EyeSklear 1814580085@qq.com
 * @LastEditTime: 2024-04-15 22:31:45
 * @FilePath: \Scene_Back\src\audio\entities\audio.entity.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
  BeforeInsert,
} from 'typeorm';
import { v4 as uuidv4 } from 'uuid';
@Entity()
export class Audio {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  creator: string;

  @Column()
  file_id: string;

  @Column({ type: 'double precision' })
  speed: number;

  @Column()
  muted: boolean;

  @Column()
  loop: boolean;

  @Column()
  currentTime: number;

  @Column({ type: 'double precision' })
  volume: number;

  @Column()
  fadeInTime: number;

  @Column()
  fadeOutTime: number;

  @Column({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  create_time: Date;

  @UpdateDateColumn({
    type: 'timestamp without time zone',
    default: () => 'CURRENT_TIMESTAMP',
  })
  update_time: Date;

  @Column()
  start: number;

  @Column()
  finish: number;

  // 标识场景实例的使用的file_id 是公共资源的还是用户资源的
  @Column('enum', { enum: ['user', 'public'], default: 'user' })
  resource_type: string;
}
